Skip to content

feat(examples): add useDevicePixels toggle to basemap-browser - #10332

Merged
chrisgervang merged 33 commits into
masterfrom
chrisgervang/basemap-browser-use-device-pixels
Aug 5, 2026
Merged

feat(examples): add useDevicePixels toggle to basemap-browser#10332
chrisgervang merged 33 commits into
masterfrom
chrisgervang/basemap-browser-use-device-pixels

Conversation

@chrisgervang

@chrisgervang chrisgervang commented May 22, 2026

Copy link
Copy Markdown
Collaborator

Summary

  • Adds a useDevicePixels checkbox to the basemap-browser control panel (toggles between true and 1.5)
  • Passes the setting through to all renderers (deck-only, MapLibre, Mapbox, Google Maps) in both pure-js and React modes
  • Helps verify that custom DPR overrides are correctly forwarded in attached-gl/interleaved mode paths (related to Bugbot finding on chore(core) Adopt luma CanvasContext #10228)

Test plan

  • With MapLibre interleaved: toggle checkbox and observe Debug Info buffer dimensions — if useDevicePixels is silently ignored, buffer dimensions won't change
  • With Deck Only: toggle checkbox as a control — buffer dimensions should change to ~1.5x CSS dimensions
  • Compare behavior between deck-only and interleaved modes to confirm the forwarding gap

🤖 Generated with Claude Code


Note

Low Risk
Example-only changes with no production library logic; limited blast radius to the basemap-browser demo.

Overview
Adds a useDevicePixels dimension to the basemap-browser example so you can exercise deck’s drawing-buffer resolution across basemaps and frameworks.

The control panel includes a pixel ratio override checkbox (toggles between default/true and 1.5), with the value reflected in the URL query string and in debug labeling. Validation warns when Mapbox is used in interleaved mode with a non-default override, since the shared canvas cannot honor it.

The setting is passed through buildConfig into every renderer path: standalone Deck, Mapbox/MapLibre overlays, and Google Maps overlays (pure JS and React). MapLibre also maps overrides to pixelRatio on the map instance and remount keys when the override changes, so buffer dimensions in Debug Info can be compared against deck-only mode.

Reviewed by Cursor Bugbot for commit d0d8bf8. Bugbot is set up for automated code reviews on this repo. Configure here.

@chrisgervang
chrisgervang requested a review from ibgreen May 22, 2026 23:40
@chrisgervang
chrisgervang changed the base branch from ib/canvas-context-93 to master May 22, 2026 23:42
@coveralls

coveralls commented May 22, 2026

Copy link
Copy Markdown

Coverage Status

coverage: 83.748%. remained the same — chrisgervang/basemap-browser-use-device-pixels into master

@chrisgervang
chrisgervang changed the base branch from master to ib/canvas-context-93 May 22, 2026 23:59
Base automatically changed from ib/canvas-context-93 to master May 26, 2026 19:01
chrisgervang and others added 2 commits May 27, 2026 14:45
… test pages

Pass pixelRatio to MapLibre/Mapbox Map constructor when useDevicePixels
is set to a custom value, since the basemap owns the canvas in
interleaved mode. Also adds standalone HTML test pages for validating
useDevicePixels across deck.gl 9.1, 9.2, 9.3, and local builds.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Comment thread examples/basemap-browser/use-device-pixels-cdn-test.html Outdated
Comment thread examples/basemap-browser/src/control-panel.tsx
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Comment thread examples/basemap-browser/src/renderers/pure-js/mapbox.ts Outdated

@ibgreen ibgreen left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice.
I really try to avoid overloading props (number, false) these days, the number of checks needed in this PR is an example of why...

@cursor cursor Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cursor Bugbot has reviewed your changes and found 1 potential issue.

Fix All in Cursor

❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, have a team admin enable autofix in the Cursor dashboard.

Reviewed by Cursor Bugbot for commit 8b16bf9. Configure here.

Comment thread examples/basemap-browser/src/control-panel.tsx
@chrisgervang

chrisgervang commented Jul 30, 2026

Copy link
Copy Markdown
Collaborator Author

Nice.
I really try to avoid overloading props (number, false) these days, the number of checks needed in this PR is an example of why...

Indeed.. the test surface grows fast too.

You've championed a few subtle but useful design principles like this over time. Flattened props over nesting comes to mind as well. Have you considered taking a pass on the code guidelines developer process docs with lessons from the field? I imagine a future where we can pipe these into AGENTS.md and Skill files

@chrisgervang
chrisgervang merged commit fb17bbd into master Aug 5, 2026
4 checks passed
@chrisgervang
chrisgervang deleted the chrisgervang/basemap-browser-use-device-pixels branch August 5, 2026 05:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants